
#############################
#### Adam Chilton        ####
#### Mila Versteeg       ####
#### Support for Torture #### 
#### Survey Experiment   ####
#### 02/08/2016        	 ####
#############################

######################################
####### Install & Load Libraries #####
######################################

# Note: These packages only need to be installed once.
# install.packages("mediation")
# install.packages("foreign")
# install.packages("rms")
# install.packages("sciplot")
# install.packages("Hmisc")
# install.packages("Zelig")
# install.packages("pwr")
# install.packages("epibasix")

#Note: These packages need to be loaded before peforming the below analysis. 
library("foreign")
library("Hmisc")
library("rms")
library("mediation")
library("sciplot")
library("RItools")
library("Zelig")
library("pwr")
library("epibasix")

###############################
####### Load the Data #########
###############################

data <- read.csv("Results_Support for Torture_08Feb16.csv", sep=",", header=TRUE)
dim(data)
names(data)

###############################
####### Create Varaibles ######
###############################


#### Key Dependent Variable  #####

data$dv_complete[data$x_app_strength=="Strongly Approve"]<- 6
data$dv_complete[data$x_app_strength=="Somewhat Approve"]<- 5
data$dv_complete[data$x_lean=="Lean Approving"]<- 4
data$dv_complete[data$x_lean=="Lean Disapproving"]<- 2
data$dv_complete[data$x_dis_strength=="Somewhat Disapprove"]<- 2
data$dv_complete[data$x_dis_strength=="Strongly Disapprove"]<- 1

data <- data[data$dv_complete %in% c(1,2,3,4,5,6),]

data$dv_dummy[data$x_app_strength=="Strongly Approve"]<- 1
data$dv_dummy[data$x_app_strength=="Somewhat Approve"]<- 1
data$dv_dummy[data$x_lean=="Lean Approving"]<- 1
data$dv_dummy[data$x_lean=="Lean Disapproving"]<-0
data$dv_dummy[data$x_dis_strength=="Somewhat Disapprove"]<- 0
data$dv_dummy[data$x_dis_strength=="Strongly Disapprove"]<- 0

#### Treatment Conditions #####

data$treat_dummy[data$treat=="&nbsp"] <- "1. Control"
data$treat_dummy[data$treat=="The interrogation methods would violate international law. The United States has signed international treaties that do not allow the use of these methods under any circumstances."] <- "2. Int'l Law"
data$treat_dummy[data$treat=="The interrogation methods would violate the constitution. The United States Constitution includes a provision that does not allow the use  of these methods under any circumstances."] <- "3. Con. Law"
data$treat_dummy[data$treat=="The interrogation methods would violate the constitution and international law. The United States Constitution includes a provision that does not allow the use of these methods under any circumstances, and the United States has signed international treaties that do not allow the use of these methods under any circumstances."] <- "4. Combined"
data$treat_dummy[data$treat=="The interrogation methods would violate the international law and the constitution. The United States has signed international treaties that do not allow the use of these methods under any circumstances, and the United States Constitution includes a provision that does not allow the use of these methods under any circumstances."] <- "4. Combined"

data$treat_dummy2[data$treat=="&nbsp"] <- "1"
data$treat_dummy2[data$treat=="The interrogation methods would violate international law. The United States has signed international treaties that do not allow the use of these methods under any circumstances."] <- "2"
data$treat_dummy2[data$treat=="The interrogation methods would violate the constitution. The United States Constitution includes a provision that does not allow the use  of these methods under any circumstances."] <- "3"
data$treat_dummy2[data$treat=="The interrogation methods would violate the constitution and international law. The United States Constitution includes a provision that does not allow the use of these methods under any circumstances, and the United States has signed international treaties that do not allow the use of these methods under any circumstances."] <- "4"
data$treat_dummy2[data$treat=="The interrogation methods would violate the international law and the constitution. The United States has signed international treaties that do not allow the use of these methods under any circumstances, and the United States Constitution includes a provision that does not allow the use of these methods under any circumstances."] <- "4"


data$treat1_dummy[data$treat=="&nbsp"] <- 1
data$treat1_dummy[data$treat!="&nbsp"] <- 0

data$treat2_dummy[data$treat=="The interrogation methods would violate international law. The United States has signed international treaties that do not allow the use of these methods under any circumstances."] <- 1
data$treat2_dummy[data$treat!="The interrogation methods would violate international law. The United States has signed international treaties that do not allow the use of these methods under any circumstances."] <- 0

data$treat3_dummy[data$treat=="The interrogation methods would violate the constitution. The United States Constitution includes a provision that does not allow the use  of these methods under any circumstances."] <- 1
data$treat3_dummy[data$treat!="The interrogation methods would violate the constitution. The United States Constitution includes a provision that does not allow the use  of these methods under any circumstances."] <- 0

data$treat4_dummy[data$treat%in% c("The interrogation methods would violate the international law and the constitution. The United States has signed international treaties that do not allow the use of these methods under any circumstances, and the United States Constitution includes a provision that does not allow the use of these methods under any circumstances.","The interrogation methods would violate the constitution and international law. The United States Constitution includes a provision that does not allow the use of these methods under any circumstances, and the United States has signed international treaties that do not allow the use of these methods under any circumstances.")] <- 1
data$treat4_dummy[data$treat=="&nbsp"] <- 0
data$treat4_dummy[data$treat=="The interrogation methods would violate international law. The United States has signed international treaties that do not allow the use of these methods under any circumstances."] <- 0
data$treat4_dummy[data$treat=="The interrogation methods would violate the constitution. The United States Constitution includes a provision that does not allow the use  of these methods under any circumstances."] <- 0

######## Mechanism Questions #########

data$int_stand[data$x_int_stand=="Strongly Agree"]<- 5
data$int_stand[data$x_int_stand=="Agree"]<- 4
data$int_stand[data$x_int_stand=="Neither Agree nor Disagree"]<- 3
data$int_stand[data$x_int_stand=="Disagree"]<-2
data$int_stand[data$x_int_stand=="Strongly Disagree"]<- 1

data$const_stand[data$x_const_stand=="Strongly Agree"]<- 5
data$const_stand[data$x_const_stand=="Agree"]<- 4
data$const_stand[data$x_const_stand=="Neither Agree nor Disagree"]<- 3
data$const_stand[data$x_const_stand=="Disagree"]<-2
data$const_stand[data$x_const_stand=="Strongly Disagree"]<- 1

data$captured[data$x_captured=="Definitely Yes"]<- 5
data$captured[data$x_captured=="Probably Yes"]<- 4
data$captured[data$x_captured=="Maybe"]<- 3
data$captured[data$x_captured=="Probably Not"]<-2
data$captured[data$x_captured=="Definitely Not"]<- 1

data$info[data$x_info=="Definitely Yes"]<- 5
data$info[data$x_info=="Probably Yes"]<- 4
data$info[data$x_info=="Maybe"]<- 3
data$info[data$x_info=="Probably Not"]<-2
data$info[data$x_info=="Definitely Not"]<- 1

data$immoral[data$x_immoral=="Definitely Yes"]<- 5
data$immoral[data$x_immoral=="Probably Yes"]<- 4
data$immoral[data$x_immoral=="Maybe"]<- 3
data$immoral[data$x_immoral=="Probably Not"]<-2
data$immoral[data$x_immoral=="Definitely Not"]<- 1

data$petition[data$x_petition=="Definitely Yes"]<- 5
data$petition[data$x_petition=="Probably Yes"]<- 4
data$petition[data$x_petition=="Maybe"]<- 3
data$petition[data$x_petition=="Probably Not"]<-2
data$petition[data$x_petition=="Definitely Not"]<- 1

data$other_cntry[data$x_other_cntry=="Definitely Yes"]<- 5
data$other_cntry[data$x_other_cntry=="Probably Yes"]<- 4
data$other_cntry[data$x_other_cntry=="Maybe"]<- 3
data$other_cntry[data$x_other_cntry=="Probably Not"]<-2
data$other_cntry[data$x_other_cntry=="Definitely Not"]<- 1


######## Demographic Variables ###############

### Gender ###
data$Male[data$r_gender=="male"] <- 1
data$Male[data$r_gender!="male"] <- 0

### Age ##

### Race ##

data$Caucasian[data$r_race=="Caucasian"] <- 1
data$Caucasian[data$r_race!="Caucasian"] <- 0
data$AfrAm[data$r_race=="African American"] <- 1
data$AfrAm[data$r_race!="African American"] <- 0
data$Asian[data$r_race=="Asian"] <- 1
data$Asian[data$r_race!="Asian"] <- 0
data$PacIsland[data$r_race=="Pacific Islander"] <- 1
data$PacIsland[data$r_race!="Pacific Islander"] <- 0
data$NativeAm[data$r_race=="6"] <- 1
data$NativeAm[data$r_race!="6"] <- 0
data$Other[data$r_race=="Other"] <- 1
data$Other[data$r_race!="Other"] <- 0

### Region ###
data$Northeast[data$sssi_censusregion==1] <- 1
data$Northeast[data$sssi_censusregion!=1] <- 0
data$Midwest[data$sssi_censusregion==2] <- 1
data$Midwest[data$sssi_censusregion!=2] <- 0
data$South[data$sssi_censusregion==3] <- 1
data$South[data$sssi_censusregion!=3] <- 0
data$West[data$sssi_censusregion==4] <- 1
data$West[data$sssi_censusregion!=4] <- 0

### Party ###

data$democrat[data$r_party_id =="Democrat"]<- 1
data$democrat[data$r_party_id !="Democrat"]<- 0
data$republican[data$r_party_id =="Republican"]<- 1
data$republican[data$r_party_id !="Republican"]<- 0
data$independent[data$r_party_id =="Independent"]<- 1
data$independent[data$r_party_id !="Independent"]<- 0

########################################
####### Subsetting Data 	############
########################################

##### by Treatment #########
data_dv1 <- data[data$treat_dummy %in% c("1. Control"),]
data_dv2 <- data[data$treat_dummy %in% c("2. Int'l Law"),]
data_dv3 <- data[data$treat_dummy %in% c("3. Con. Law"),]
data_dv4 <- data[data$treat_dummy %in% c("4. Combined"),]

##### By Political Party ############
data_dem <- data[data$r_party_id %in% c("Democrat"),]
data_rep <- data[data$r_party_id %in% c("Republican"),]
data_ind <- data[data$r_party_id %in% c("Independent"),]

data_dem_dv1 <- data_dem[data_dem$treat_dummy %in% c("1. Control"),]
data_dem_dv2 <- data_dem[data_dem$treat_dummy %in% c("2. Int'l Law"),]
data_dem_dv3 <- data_dem[data_dem$treat_dummy %in% c("3. Con. Law"),]
data_dem_dv4 <- data_dem[data_dem$treat_dummy %in% c("4. Combined"),]

data_rep_dv1 <- data_rep[data_rep$treat_dummy %in% c("1. Control"),]
data_rep_dv2 <- data_rep[data_rep$treat_dummy %in% c("2. Int'l Law"),]
data_rep_dv3 <- data_rep[data_rep$treat_dummy %in% c("3. Con. Law"),]
data_rep_dv4 <- data_rep[data_rep$treat_dummy %in% c("4. Combined"),]

data_ind_dv1 <- data_ind[data_ind$treat_dummy %in% c("1. Control"),]
data_ind_dv2 <- data_ind[data_ind$treat_dummy %in% c("2. Int'l Law"),]
data_ind_dv3 <- data_ind[data_ind$treat_dummy %in% c("3. Con. Law"),]
data_ind_dv4 <- data_ind[data_ind$treat_dummy %in% c("4. Combined"),]


########################################
####### Balance		 	    ############
########################################

## Control
xBalance(treat1_dummy~Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South, data=data,report="all",na.rm=TRUE)

## Int'l Law
xBalance(treat2_dummy~Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South, data=data,report="all",na.rm=TRUE)

## Con. Law
xBalance(treat3_dummy~Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South, data=data,report="all",na.rm=TRUE)

## Combined
xBalance(treat4_dummy~Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South, data=data,report="all",na.rm=TRUE)


####################################################
####### Primary Results 	 				############
####################################################

#### Creating Figure 1 ####
par(mar=c(6,5,1,1),mfrow=c(1,1)) 
lineplot.CI(x.factor = treat_dummy, response = dv_dummy, data =  data,cex = 2, ylab = "Mean Response (% Support)",cex.lab = 1, xlab="Treatment Group", x.leg = 1, col = c("black","black"), pch = c(16,16), ylim=c(0.4,0.6),lty=0,ci.fun=function(x) c(mean(x)-1.645*se(x), mean(x)+1.645*se(x)))

#### Control ####
t.test(data_dv1$dv_dummy,conf.level = 0.90)

#### Int'l Law####
t.test(data_dv2$dv_dummy,conf.level = 0.90)

#Control Compared to Int'l Law
t.test(data_dv1$dv_dummy,data_dv2$dv_dummy,conf.level = 0.90)

#### Con. Law ####
t.test(data_dv3$dv_dummy,conf.level = 0.90)

# Control Compared to Con Law
t.test(data_dv1$dv_dummy,data_dv3$dv_dummy,conf.level = 0.90)

# Control Compared to Con Law - 6 Point Scale
t.test(data_dv1$dv_complete,data_dv3$dv_complete,conf.level = 0.90)

# IL Compared to Con Law
t.test(data_dv2$dv_dummy,data_dv3$dv_dummy,conf.level = 0.90)

#### Combined ####
t.test(data_dv4$dv_dummy,conf.level = 0.90)

# Control Compared to Combined
t.test(data_dv1$dv_dummy,data_dv4$dv_dummy,conf.level = 0.90)

# Int'l Law Compared to Combined
t.test(data_dv2$dv_dummy,data_dv4$dv_dummy,conf.level = 0.90)

# Con. Law Compared to Combined
t.test(data_dv3$dv_dummy,data_dv4$dv_dummy,conf.level = 0.90)


####### Effect Size Needed to Find A Result	 	############

n <- ((513+535+559+552)/4)*2

sigmax <- sd(data$dv_dummy)

### 10% Confidence Level ######
diffDetect(n,sigma=sigmax,alpha=0.1, power=0.8, two.tailed=TRUE)

### 5% Confidence Level ######
diffDetect(n,sigma=sigmax,alpha=0.05, power=0.8, two.tailed=TRUE)


####################################################
#######  Results by Party Identification	    ########
####################################################

#### Creating Figure 1 ####
par(mar=c(6,5,1,1),mfrow=c(1,2)) 
lineplot.CI(x.factor = treat_dummy2, response = dv_dummy, data =  data_dem,cex = 2, ylab = "Mean Response (% Support)",cex.lab = 1, xlab="Democrats", x.leg = 1, col = c("black","black"), pch = c(16,16), ylim=c(0.30,0.7),lty=0,ci.fun=function(x) c(mean(x)-1.645*se(x), mean(x)+1.645*se(x)))

lineplot.CI(x.factor = treat_dummy2, response = dv_dummy, data =  data_rep,cex = 2, ylab = "Mean Response (% Support)",cex.lab = 1, xlab="Republicans", x.leg = 1, col = c("black","black"), pch = c(16,16), ylim=c(0.30,0.7),lty=0,ci.fun=function(x) c(mean(x)-1.645*se(x), mean(x)+1.645*se(x)))

##### Sample Size by Party Id ######

#Overall
dim(data)

dim(data_dem)
891/2159

dim(data_rep)
514/2159

####### Overall Results by Party #########

#Democrats Overall
t.test(data_dem$dv_dummy,conf.level = 0.90)

# Republicans Overall
t.test(data_rep$dv_dummy,conf.level = 0.90)

####### Results for Democrats #########

t.test(data_dem_dv1$dv_dummy,conf.level = 0.90)
t.test(data_dem_dv2$dv_dummy,conf.level = 0.90)
t.test(data_dem_dv3$dv_dummy,conf.level = 0.90)
t.test(data_dem_dv4$dv_dummy,conf.level = 0.90)

# Control Compared to IL
t.test(data_dem_dv1$dv_dummy,data_dem_dv2$dv_dummy,conf.level = 0.90)

# Control Compared to Con Law

t.test(data_dem_dv1$dv_dummy,data_dem_dv3$dv_dummy,conf.level = 0.90)

####### Results for Republicans #########

t.test(data_rep_dv1$dv_dummy,conf.level = 0.90)
t.test(data_rep_dv2$dv_dummy,conf.level = 0.90)
t.test(data_rep_dv3$dv_dummy,conf.level = 0.90)
t.test(data_rep_dv4$dv_dummy,conf.level = 0.90)


############ Explanation #1: Wallace's Sample #########################
library(foreign)

## Wallaced Replication Data is available at:
## https://dataverse.harvard.edu/dataset.xhtml?persistentId=hdl:1902.1/19881
data.x <- read.dta("torture_law.dta")

table(data.x$ideology0)
dim(data.x)
#Conservative
111+521+370
1002/2817
#liberal 
290+361+87
738/2817
#moderate
1031/2817

############### Explanation #2: Balance - With Party Id 	  ##################

## Control
xBalance(treat1_dummy~Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South+democrat+republican+independent, data=data,report="all",na.rm=TRUE)

## Int'l Law
xBalance(treat2_dummy~Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South+democrat+republican+independent, data=data,report="all",na.rm=TRUE)

## Con. Law
xBalance(treat3_dummy~Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South+democrat+republican+independent, data=data,report="all",na.rm=TRUE)

## Combined
xBalance(treat4_dummy~Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South+democrat+republican+independent, data=data,report="all",na.rm=TRUE)

########### Explanation #3: Comparing Results for Independents ##############

## Wallace's Results for Moderates
data.y <- data.x[data.x$ideology0 %in%c("Moderate, middle of the road"),]
dim(data.y)
data.treat <- data.y[data.y$treaty==1,]
data.notreat <- data.y[data.y$treaty==0,]

summary(data.treat$torture2)
270+157
157/427

summary(data.notreat$torture2)
214+170
170/384

(157/427)-(170/384)

## Our Results for Independets
t.test(data_ind_dv1$dv_dummy,data_ind_dv2$dv_dummy,conf.level = 0.90)
0.4861878-0.3875000
t.test(data_ind_dv1$dv_dummy,data_ind_dv3$dv_dummy,conf.level = 0.90)
0.3878788-0.3875000

####################################################
#######  Mechanism Results              ############
####################################################


#### Creating Figure 1 ####
par(mar=c(2,5,3,1),mfrow=c(3,2)) 


data1 <- data[data$int_stand %in% c(1:5),]
lineplot.CI(x.factor = treat_dummy, response = int_stand, data =  data1,cex = 2, ylab = "Mean Response",cex.lab = 1, xlab="Treatment Group", x.leg = 1, col = c("black","black"), pch = c(16,16), ylim=c(3.4,3.8),lty=0,main="International Standards",ci.fun=function(x) c(mean(x)-1.645*se(x), mean(x)+1.645*se(x)))

data2 <- data[data$const_stand %in% c(1:5),]
lineplot.CI(x.factor = treat_dummy, response = const_stand, data =  data2,cex = 2, ylab = "Mean Response",cex.lab = 1, xlab="Treatment Group", x.leg = 1, col = c("black","black"), pch = c(16,16), ylim=c(3.7,4.1),lty=0,main="Constitutional Standards",ci.fun=function(x) c(mean(x)-1.645*se(x), mean(x)+1.645*se(x)))

data3 <- data[data$captured %in% c(1:5),]
lineplot.CI(x.factor = treat_dummy, response = captured, data =  data3,cex = 2, ylab = "Mean Response",cex.lab = 1, xlab="Treatment Group", x.leg = 1, col = c("black","black"), pch = c(16,16), ylim=c(4.0,4.4),lty=0,main="Risk to Americans",ci.fun=function(x) c(mean(x)-1.645*se(x), mean(x)+1.645*se(x)))

data4 <- data[data$other_cntry %in% c(1:5),]
lineplot.CI(x.factor = treat_dummy, response = other_cntry, data =  data4,cex = 2, ylab = "Mean Response",cex.lab = 1, xlab="Treatment Group", x.leg = 1, col = c("black","black"), pch = c(16,16), ylim=c(3.4,3.8),lty=0,main="Risk to Others",ci.fun=function(x) c(mean(x)-1.645*se(x), mean(x)+1.645*se(x)))

data5 <- data[data$info %in% c(1:5),]
lineplot.CI(x.factor = treat_dummy, response = info, data =  data5,cex = 2, ylab = "Mean Response",cex.lab = 1, xlab="Treatment Group", x.leg = 1, col = c("black","black"), pch = c(16,16), ylim=c(3.2,3.6),lty=0,main="Valuable Information",ci.fun=function(x) c(mean(x)-1.645*se(x), mean(x)+1.645*se(x)))

data6 <- data[data$immoral %in% c(1:5),]
lineplot.CI(x.factor = treat_dummy, response = immoral, data =  data6,cex = 2, ylab = "Mean Response",cex.lab = 1, xlab="", x.leg = 1, col = c("black","black"), pch = c(16,16), ylim=c(3.6,4),lty=0, main="Morality",ci.fun=function(x) c(mean(x)-1.645*se(x), mean(x)+1.645*se(x)))

### Statistically Significant Results

t.test(data_dv1$info,data_dv3$info,conf.level = 0.90)
t.test(data_dv1$int_stand,data_dv3$int_stand,conf.level = 0.90)



#########################################################################
####### Demographic Characteristics of Our Sample	 	    ############
#########################################################################

### Gender #####
summary(data$Male)
sd(data$Male)
table(data$Male)

### Age #####
dataage <- data$age
dataage <- na.omit(dataage)
summary(dataage)
sd(dataage)
length(dataage)

### Caucasion #####
summary(data$Caucasian)
sd(data$Caucasian)
table(data$Caucasian)

### African American #####
summary(data$AfrAm)
sd(data$AfrAm)
table(data$AfrAm)

### Asian #####
summary(data$Asian)
sd(data$Asian)
table(data$Asian)

### Pacific Islander #####
summary(data$PacIsland)
sd(data$PacIsland)
table(data$PacIsland)

### Native American #####
summary(data$NativeAm)
sd(data$NativeAm)
table(data$NativeAm)

### Other #####
summary(data$Other)
sd(data$Other)
table(data$Other)

### Northeast #####
summary(data$Northeast)
sd(data$Northeast)
table(data$Northeast)

### Midwest #####
summary(data$Midwest)
sd(data$Midwest)
table(data$Midwest)

### South #####
summary(data$South)
sd(data$South)
table(data$South)

### West #####
summary(data$West)
sd(data$West)
table(data$West)


###########################################################################
####### Survey Results - Tables	Using Binary Response Variables    ########
###########################################################################


#### Table of Figure 1 Results #####
t.test(data_dv1$dv_dummy,conf.level = 0.90)
t.test(data_dv2$dv_dummy,conf.level = 0.90)
t.test(data_dv3$dv_dummy,conf.level = 0.90)
t.test(data_dv4$dv_dummy,conf.level = 0.90)
t.test(data$dv_dummy,conf.level = 0.90)

#### Table of Figure 2 Results #####

## Results for Democrats
t.test(data_dem_dv1$dv_dummy,conf.level = 0.90)
t.test(data_dem_dv2$dv_dummy,conf.level = 0.90)
t.test(data_dem_dv3$dv_dummy,conf.level = 0.90)
t.test(data_dem_dv4$dv_dummy,conf.level = 0.90)
t.test(data_dem$dv_dummy,conf.level = 0.90)

## Results for Republicans
t.test(data_rep_dv1$dv_dummy,conf.level = 0.90)
t.test(data_rep_dv2$dv_dummy,conf.level = 0.90)
t.test(data_rep_dv3$dv_dummy,conf.level = 0.90)
t.test(data_rep_dv4$dv_dummy,conf.level = 0.90)
t.test(data_rep$dv_dummy,conf.level = 0.90)

#### Table of Figure 3 Results #####

## Results for Intl Stand
t.test(data_dv1$int_stand,conf.level = 0.90)
t.test(data_dv2$int_stand,conf.level = 0.90)
t.test(data_dv3$int_stand,conf.level = 0.90)
t.test(data_dv4$int_stand,conf.level = 0.90)

## Results for Constitutional Stand 
t.test(data_dv1$const_stand,conf.level = 0.90)
t.test(data_dv2$const_stand,conf.level = 0.90)
t.test(data_dv3$const_stand,conf.level = 0.90)
t.test(data_dv4$const_stand,conf.level = 0.90)

## Results for Risk to Americans 
t.test(data_dv1$captured,conf.level = 0.90)
t.test(data_dv2$captured,conf.level = 0.90)
t.test(data_dv3$captured,conf.level = 0.90)
t.test(data_dv4$captured,conf.level = 0.90)

## Results for Risk to Others 
t.test(data_dv1$other_cntry,conf.level = 0.90)
t.test(data_dv2$other_cntry,conf.level = 0.90)
t.test(data_dv3$other_cntry,conf.level = 0.90)
t.test(data_dv4$other_cntry,conf.level = 0.90)

## Results for Information
t.test(data_dv1$info,conf.level = 0.90)
t.test(data_dv2$info,conf.level = 0.90)
t.test(data_dv3$info,conf.level = 0.90)
t.test(data_dv4$info,conf.level = 0.90)

## Results for Morality 
t.test(data_dv1$immoral,conf.level = 0.90)
t.test(data_dv2$immoral,conf.level = 0.90)
t.test(data_dv3$immoral,conf.level = 0.90)
t.test(data_dv4$immoral,conf.level = 0.90)



###########################################################################
####### Survey Results - Tables	Using Six-Point Response Variables    #####
###########################################################################

#### Table of Figure 1 Results #####
t.test(data_dv1$dv_complete,conf.level = 0.90)
t.test(data_dv2$dv_complete,conf.level = 0.90)
t.test(data_dv3$dv_complete,conf.level = 0.90)
t.test(data_dv4$dv_complete,conf.level = 0.90)
t.test(data$dv_complete,conf.level = 0.90)


#### Table of Figure 2 Results #####

## Results for Democrats
t.test(data_dem_dv1$dv_complete,conf.level = 0.90)
t.test(data_dem_dv2$dv_complete,conf.level = 0.90)
t.test(data_dem_dv3$dv_complete,conf.level = 0.90)
t.test(data_dem_dv4$dv_complete,conf.level = 0.90)
t.test(data_dem$dv_complete,conf.level = 0.90)

## Results for Republicans
t.test(data_rep_dv1$dv_complete,conf.level = 0.90)
t.test(data_rep_dv2$dv_complete,conf.level = 0.90)
t.test(data_rep_dv3$dv_complete,conf.level = 0.90)
t.test(data_rep_dv4$dv_complete,conf.level = 0.90)
t.test(data_rep$dv_complete,conf.level = 0.90)

#############################################################
#######  Survey Results - Regression Analysis	    ########
#############################################################

########### Logit Regressions ##############

## Full Sample ##
logit1 <- lrm(dv_dummy ~  treat2_dummy+treat3_dummy+treat4_dummy+Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South, data=data)
print(logit1, digits=2)

## Dems Only ##
logit2 <- lrm(dv_dummy ~  treat2_dummy+treat3_dummy+treat4_dummy+Male+age+Caucasian+AfrAm+Asian+PacIsland+Northeast+Midwest+South, data=data_dem)
print(logit2, digits=2)

## Reps Only ##
logit3 <- lrm(dv_dummy ~  treat2_dummy+treat3_dummy+treat4_dummy+Male+age+Caucasian+AfrAm+Asian+PacIsland+Northeast+Midwest+South, data=data_rep)
print(logit3, digits=2)


########### Ordered - Logit Regressions ##############

## Full Sample ##
ologit1 <- lrm(as.factor(dv_complete) ~  treat2_dummy+treat3_dummy+treat4_dummy+Male+age+Caucasian+AfrAm+Asian+PacIsland+NativeAm+Northeast+Midwest+South, data=data)
print(ologit1, digits=2)

## Dems Only ##
ologit2 <- lrm(as.factor(dv_complete) ~  treat2_dummy+treat3_dummy+treat4_dummy+Male+age+Caucasian+AfrAm+Asian+PacIsland+Northeast+Midwest+South, data=data_dem)
print(ologit2, digits=2)

## Reps Only ##
ologit3 <- lrm(as.factor(dv_complete) ~  treat2_dummy+treat3_dummy+treat4_dummy+Male+age+Caucasian+AfrAm+Asian+PacIsland+Northeast+Midwest+South, data=data_rep)
print(ologit3, digits=2)
